import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 忽略跳转相同path的console错误
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
// import HelloWorld from '../components/HelloWorld.vue'
// import Home from '../components/home.vue'
import Index from '../view/Index.vue'
import Home from '../view/Home.vue'
import PhoneIndex from '../view/PhoneIndex.vue'
import HomeIndex from '../components/Home/HomeIndex.vue'
import UserIndex from '../components/User/Index.vue'
import GreenLandIndex from '../components/GreenLand/Index.vue'
import WaringManage from '../components/WaringManage/index.vue'
import SettingIdex from '../components/Setting/Index.vue'
export default new VueRouter({
    routes:[
        {
            //路由路径  
            path:'*', 
            //路由名称
            name:'login',
            redirect:'/login'
        },
        {
            //路由路径  
            path:'/login', 
            //路由名称
            name:'login',
            //路由组件
            component:Index 
        },
        {
            //路由路径  
            path:'/home', 
            //路由名称
            name:'home',
            //路由组件
            component:Home ,
            children:[
                {
                    path:'index',
                    name:'home-index',
                    component:HomeIndex
                },{
                    path:'user',
                    name:'user-index',
                    component:UserIndex
                },{
                    path:'greenLand',
                    name:'greenLand-index',
                    component:GreenLandIndex
                },{
                    path:'waring',
                    name:'waring-index',
                    component:WaringManage
                },{
                    path:'setting',
                    name:'setting-index',
                    component:SettingIdex
                }
            ]

        
        }, 
        {
            //路由路径  
            path:'/phone', 
            //路由名称
            name:'phone-index',
            //路由组件
            component:PhoneIndex 
        },
    ]
        
    })